<!-- Message Error -->
<?php if ($this->session->flashdata('f_frontpage')): ?>
    <div class="msg msg-ok boxwidth">
        <p><strong><?php echo $this->session->flashdata('f_frontpage'); ?></strong></p>
    </div>
<?php endif; ?>


<!-- Box -->
<div class="box">
    <!-- Box Head -->
    <div class="box-head">
        <h2 class="left">+ <a href="<?php echo base_url();?>admin/frontpage/add" class="top_box_link">Add frontpage item</a></h2>
        <div class="right">
            <form action="<?php echo base_url();?>admin/frontpage/search" method="post">
                <label>search frontpage</label>
                <input type="text" class="field small-field" name="frontpage_name"/>
                <input type="submit" class="button" value="search" />
            </form>
        </div>
    </div>
    <!-- End Box Head -->	

    <!-- Table -->
    <div class="table">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Type</th>
                <th>Date Added/Modifed</th>
                <th width="110" class="ac">Control</th>
            </tr>
            <?php $i=0;?>
            <?php foreach($frontpage->result() as $p):?>
            <tr <?php echo (($i++%2)!=0)?'class="odd"':'';?>>
                <td class="column_id">
                    <a class="column_edit" title="edit this item" href="<?php echo base_url();?>admin/frontpage/edit/<?php echo $p->id;?>">
                        <?php echo $p->id;?>
                    </a>
                </td>
                <td>
                    <h3>
                        <?php echo $p->name;?>
                    </h3>
                </td>
                <td>
                    <?php 
                    if($p->type==0){
                        echo '1 Image';
                    }else if($p->type==1){
                        echo '2 Image';
                    }else {
                        echo '3 Image';
                    }
                    ;?>
                </td>
                <td><?php echo $p->modified_date;?></td>
                <td class="center">
                    <a href="<?php echo base_url();?>admin/frontpage/delete/<?php echo $p->id;?>" class="ico del column_delete">Delete</a>
                </td>
            </tr>
            <?php endforeach;?>
        </table>
        <!-- Pagging -->
        <div class="pagging">
            <div class="left">
                Showing <?php echo $start+1;?>-<?php echo $start+$frontpage->num_rows();?> of <?php echo $count;?>
            </div>
            <div class="right">
                <?php if($page>1):?>
                <a href="<?php echo base_url();?>admin/frontpage/page/<?php echo $page-1;?>">Previous</a>
                <?php endif;?>
                <?php if(($start+$frontpage->num_rows()) < $count):?>
                <a href="<?php echo base_url();?>admin/frontpage/page/<?php echo $page+1;?>">Next</a>
                <?php endif;?>
            </div>
        </div>
        <!-- End Pagging -->

    </div>
    <!-- Table -->

</div>
<!-- End Box -->